<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>表单基础</title>
</head>
<body>
  <form id="form1" name="form1"></form>
  <form name="form2"></form>
  <script>
    const firstForm = document.forms[0];
    const myForm = document.forms.form2;

    console.log(firstForm, myForm, document.form2 /* 不推荐 */);
  </script>
</body>
</html>